/**************************************************************************************
*
*	Copyright (C) 2009 Brent Andrew Chua - See LICENSE.txt for more info.
*		
*	Filename	-	BitmapMasked.h
*
*	Description -	Masked bitmap class for rendering bitmap objects with transparency.
*					This doesn't support translucency. Transparency using color-keys.
*
*	Comments	-	If you don't understand some part of the code, use MSDN!!!
*						Move the cursor to the function/type then hit F1 in VS.
*
*					RGB( 255, 0, 255 ) - Is Magenta. uh... pink?
*
*	Modification History:
*			Name			   Date					Description
*			CodeSushi	-	11/17/2009	-	Creation of this file
**************************************************************************************/

#ifndef _BITMAP_MASKED_H_
#define _BITMAP_MASKED_H_

#include <windows.h>
#include "../../Pulse Lib/Include/Pulse.h"


#include "Bitmap.h"

using namespace Pulse;


class BitmapMasked : public Bitmap
{
public:

	BitmapMasked( HINSTANCE hAppInst, const CHAR *pImageFileName, const UINT colorKey = RGB( 255, 0, 255 ) , const PositionType posType = POS_UPPER_LEFT, const BlendOptions bOp = BLEND_SRC_COPY );
	virtual ~BitmapMasked( void );

	virtual const BitmapType GetType( void ) const;

	void SetColorKey( UINT colorKey = RGB( 255, 0, 255 ) );

	virtual void Render( HDC hBBDC, HDC hSprDC, INT x, INT y );
	virtual void Render( HDC hBBDC, HDC hSprDC, INT x, INT y, INT w, INT h, INT srcX, INT srcY );
	//virtual void Render( HDC hBBDC, HDC hSprDC, RECT dest, INT srcX, INT srcY ); // Should be the same as Bitmap
	
	virtual Pulse::BOOL TestPoint( INT x, INT y );

protected:

	UINT m_cKey;

};

PSX_INLINE BitmapMasked::BitmapMasked( HINSTANCE hAppInst, const CHAR *pImageFileName, const UINT colorKey /*= RGB( 255, 0, 255 )*/, const PositionType posType /*= POS_UPPER_LEFT*/, const BlendOptions bOp /*= BLEND_SRC_COPY*/ )
	: Bitmap( hAppInst, pImageFileName, posType, bOp ), m_cKey( colorKey )
{

}

PSX_INLINE BitmapMasked::~BitmapMasked( void )
{

}

PSX_INLINE const Bitmap::BitmapType BitmapMasked::GetType( void ) const
{
	return TYPE_MASKED_BITMAP;
}

PSX_INLINE void BitmapMasked::SetColorKey( UINT colorKey /*= RGB( 255, 0, 255 )*/ )
{
	m_cKey = colorKey;
}


#endif /* _BITMAP_MASKED_H_ */